package com.ruoyi.hqfinance.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.hqfinance.domain.HqReturnOperateFee;
import com.ruoyi.hqfinance.domain.vo.HqReturnOperateFeeVo;
import com.ruoyi.hqfinance.service.HqReturnOperateFeeService;
import com.ruoyi.logistic.domain.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/hq/returnOperate")
@Api(tags = "总部财务-退件操作费报表")
public class HqReturnOperateFeeController {

    @Autowired
    private HqReturnOperateFeeService hqReturnOperateFeeService;
    @ApiOperation("汇总")
    @PostMapping("/collect")
    public R collect(@RequestBody HqReturnOperateFeeVo vo){
        if (vo.getEndTime() == null || vo.getStartTime() == null || vo.getTimeType() == null ||vo.getSelectType() == null){
            return R.fail("请输入查询所需的条件！");
        }
        List<HqReturnOperateFee> returnOperateFees = hqReturnOperateFeeService.collect(vo);
        if (returnOperateFees == null || returnOperateFees.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(PageInfo.info(returnOperateFees));
        }
    }
}
